package edu.caece.langprocessor.syntax;

import java.util.List;

public class Production {
	
	private NonTerminal leftSideItem;
	private List<GrammarItem> rightSideItems;
	private final String productionClass;

	public Production(String productionClass, NonTerminal leftSideItem, List<GrammarItem> rightSideItems){
		this.productionClass = productionClass;
		this.leftSideItem = leftSideItem;
		this.rightSideItems = rightSideItems;
	}

	public NonTerminal getLeftSideItem() {
		return leftSideItem;
	}

	public String getProductionClass() {
		return productionClass;
	}
	
	public List<GrammarItem> getRightSideItems() {
		return rightSideItems;
	}
	
	@Override
	public String toString() {
		StringBuilder str = new StringBuilder();
		
		str.append(this.leftSideItem);
		str.append(" -->");
		for (GrammarItem item : this.rightSideItems) {
			str.append(" ");
			str.append(item.toString());
		}
		return str.toString();
	}
}
